#ifndef _YL_SYMBOL_LOOKUP_
#define _YL_SYMBOL_LOOKUP_

#include <string>

namespace yoctolog_viewer
{
	// Singleton class used for looking up symbols, given process handles and addresses
	// Symbol lookup only allows one process to be registered (on one thread) with SymInitialize at a time,
	// so having a singleton makes sense here.
	class SymbolLookup
	{
	public:
		static SymbolLookup &Instance() { if( !ms_pInstance ) ms_pInstance = new SymbolLookup(); return *ms_pInstance; }

		void InitForProcess(unsigned int uiProcess);
		std::string GetSymbolFromAddr(unsigned int uiProcess, unsigned int iAddr);
		void GetLineNumberFromAddr(unsigned int uiProcess, unsigned int iAddr, std::string &strFilename, int &iLineNumber);
		void CleanUp();

	private:

		static SymbolLookup *	ms_pInstance;

		SymbolLookup();
		~SymbolLookup();

		unsigned int			m_hCurrentProcess;

	};
}

#endif